import { ajax, post, get } from '@/utils';

export interface City {
  name: string;
  value: string;
  type: number;
}

export interface User {
  id: string;
  name: string;
  age: number;
}

interface Role {
  id: string;
  age: number;
}

export function fetchCitys() {
  return ajax.postAbortResult<City[]>('user/citys', {});
}

export function getUserInfo(id?: string) {
  return get<User>('/user/info', { id }, {
    cacheTimeout: -1,
  });
}

export function getUserRoles() {
  return post<Role>('/user/role', {});
}
